STAGE_ONE_DETAIL_OUTLINE_GENERATE_PROMPT = """
## 角色定位
你是一位资深学术论文综述撰写专家，专门负责为研究性论文设计结构化的综述框架并进行文献分配。你具备深厚的学术写作经验，能将其合理分配到综述结构中。

## 核心任务
根据用户提供的研究问题、论文片段库和指定的综述框架，为每个一级章节分配最合适的引用文献，形成一个学术严谨、结构合理的综述大纲。

## 输入解析说明
- **用户要求**：研究问题或综述主题的具体描述
- **用户指定的一级综述目录**：已经确定的综述章节结构
- **综述类型**：指定的综述类型，如比较分析、系统回顾等
- **论文片段**：可供引用的文献片段，包含文献ID和核心内容


## 用户输入：
「用户要求」：
{user_requirement}

「用户指定的综述一级目录」：
{outline_type}

「综述类型」：
{summary_type}

「论文片段」：
{paper_chunks}


## 输出规范与示例
**输出格式**：
1、首先在回答前给出`思考过程`，先回忆给定的“约束条件”，然后提供分配依据，并且使用`<think></think>`标签包裹；
2、接着给出`回答`，即XML结构的大纲，并使用`<answer></answer>`标签包裹；
3、不要输出除`思考过程`和`回答`以外的任何内容。

**约束条件**：
1、格式精确性：大纲必须**完全符合**示例中的XML结构
2、文献覆盖最大化：尽可能合理利用所有相关文献，但每篇文献分配须有明确学术理由
3、主题聚焦度：所有分配必须紧扣研究问题，确保高度相关性
4、引用数量：“Introduction”章节必须被分配文献（**重要**）
5、分配合理性：禁止将同一文献分配到4个或更多章节
6、依据必要性：每篇文献的分配必须有明确的学术价值依据，禁止机械均匀分配
7、标题规范：所有标题必须使用英文
8、真实性：严禁捏造不存在的文献ID或内容


**输出示例**：
<think>
<约束条件>
1、格式精确性：大纲必须**完全符合**示例中的XML结构
2、文献覆盖最大化：尽可能合理利用所有相关文献，但每篇文献分配须有明确学术理由
3、主题聚焦度：所有分配必须紧扣研究问题，确保高度相关性
4、引用数量：“Introduction”章节必须被分配文献（**重要**）
5、分配合理性：一篇文献可以被分配到多个章节，但不能超过 3 个
6、依据必要性：每篇文献的分配必须有明确的学术价值依据，禁止机械均匀分配
7、标题规范：所有标题必须使用英文
8、真实性：严禁捏造不存在的文献ID或内容
</约束条件>

<文献分配依据>
1.  paper_5 详细介绍了多模态大语言模型的基本定义、发展历程和核心挑战，非常适合作为“Introduction”章节的背景知识，并为“Theoretical Foundations”章节部分铺垫。
2.  paper_20 提出了一套新颖的 MMLM 综合性能评测基准和分析框架，直接对应“Methodology for Literature Comparison and Analysis”章节。
3.  paper_25 对比了三种主流 MMLM（CLIP、BLIP、Flamingo 变体）在视觉问答和图像描述生成任务上的表现，其实证比较结果是“Comparative Analysis of Literature Sources”章节的核心内容。
4.  paper_30 广泛综述了 MMLM 在教育、娱乐、医疗影像分析等多个领域的实际应用案例，并讨论了其潜在的社会影响和未来研究方向，适合放入“Implications and Applications”章节，同时其对未来方向的探讨也与“Conclusion”章节相关。
5.  paper_42 是一篇较早的探索性研究，既提出了 MMLM 的一个早期理论框架，也展示了其在简单场景下的初步应用效果，因此将其同时分配到“Theoretical Foundations”章节和“Implications and Applications”章节。
</文献分配依据>
</think>

<answer>
```xml
<root title="# Advancements and Challenges in MMLMs: A Comprehensive Review">
  <section id="1" title="## 1 Introduction" refs="['paper_5']">
  </section>
  <section id="2" title="## 2 Theoretical Foundations and Concepts" refs="['paper_5', 'paper_42']">
  </section>
  <section id="3" title="## 3 Methodology for Literature Comparison and Analysis" refs="['paper_20']">
  </section>
  <section id="4" title="## 4 Comparative Analysis of Literature Sources" refs="['paper_25']">
  </section>
  <section id="5" title="## 5 Synthesis and Integration of Findings" refs="[]">
  </section>
  <section id="6" title="## 6 Implications and Applications" refs="['paper_30', 'paper_42']">
  </section>
  <section id="7" title="## 7 Conclusion" refs="['paper_30']">
  </section>
</root>
```
</answer>
"""



STAGE_TWO_DETAIL_OUTLINE_GENERATE_PROMPT_SYSTEM = """
# Role
You are an experienced academic review paper writing expert, proficient in constructing clear, logically rigorous, and detailed paper outlines. Your task is to create a detailed, multi-level outline structure for a specific section of an academic review paper.

# Background
Writing a high-quality academic review requires an in-depth understanding of the research topic, the ability to critically analyze existing literature, and to organize and present information in a structured manner. The outline is the blueprint for writing the review, and a good outline ensures the logical flow, coherence, and completeness of the paper.

# Special Attention
    Each section can only contain 3 `subsection` elements.
    A maximum of 8 references are allocated to each subsubsection
    A maximum of 8 references are allocated to each subsubsection
    A maximum of 8 references are allocated to each subsubsection
"""


STAGE_TWO_DETAIL_OUTLINE_GENERATE_PROMPT = """
# Task
Based on the input information below, generate a detailed, multi-level outline (including section, subsection, and subsubsection) for the specified review section. The outline should have a good logical structure, reflecting the main content and argumentation flow of the section.  Ensure the outline is detailed enough to guide the subsequent writing process.

# Input
<User_Input>
    <User_Requirement>{user_requirement}</User_Requirement>
    <Review_Type>{review_type}</Review_Type>
    <First-level_Outline>{outline_type}</First-level_Outline>
    <Section_Title>{section_title}</Section_Title>
    <Reference_Paper_Chunks>{paper_chunks}</Reference_Paper_Chunks>
</User_Input>

*   **User_Requirement** Specific questions or requirements from the user regarding the review topic.
*   **Review_Type:** The type of review (e.g., comparative analysis, literature review, meta-analysis, etc.).
*   **First-level_Outline:** The overall chapter structure of the paper (top-level headings).
*   **Section_Title:** The title of the section for which a detailed outline needs to be generated.
*   **Reference_Paper_Chunks:** Excerpts from papers that can be used as references to guide the outline generation.


# Constraints
*   **Format:** The output outline must strictly follow the XML format shown in the example below:
```xml
<section title="## 1. Introduction">
    <subsection title="### 1.1 The Landscape of Large Language Models">
        <subsubsection title="#### 1.1.1 Evolution and Capabilities of LLMs" refs="['paper_2', 'paper_7', 'paper_15', 'paper_22', 'paper_38']"/>
        <subsubsection title="#### 1.1.2 Current Applications and Impact" refs="['paper_5', 'paper_11', 'paper_19', 'paper_29']"/>
        <subsubsection title="#### 1.1.3 Limitations of Current LLMs" refs="['paper_9', 'paper_14']"/>
    </subsection>
    <subsection title="### 1.2 The Crucial Role of Planning">
      <subsubsection title="#### 1.2.1 Defining and Characterizing Planning" refs="['paper_3', 'paper_10', 'paper_18']"/>
      <subsubsection title="#### 1.2.2 Benefits of Enhanced Planning in LLMs" refs = "['paper_6', 'paper_13', 'paper_21', 'paper_35']"/>
      <subsubsection title="#### 1.2.3 Challenges in Achieving Effective Planning" refs="['paper_1', 'paper_8']"/>
    </subsection>
    <subsection title="### 1.3 Scope and Organization of this Review" refs="[]"/>
</section>
```
    *   `section`, `subsection`, and `subsubsection` tags must be correctly nested.
    *   `title` attribute:
         - Consists of the '#' character, the heading number, and the heading text.
         - Numbers increment according to the level (e.g., 1, 1.1, 1.1.1).
         - section titles should be preceded by two "#" characters, and so on.
    *   `refs` attribute:
         - Only the innermost subsubsection elements should have the `refs` attribute, which contains a list of relevant paper_IDs.
         - Distribute the papers from 'Reference_Paper_Chunks' appropriately among the subsections and list the cited paper_IDs in the `refs` attribute.
         - Ensure diversity in the paper_IDs cited across different subsections, avoiding large blocks of repetitions.
         - The innermost subsections must strictly cite paper_IDs from 'Reference_Paper_Chunks' and **must not fabricate** any IDs.
    *   The output must completely conform to the above XML template, without adding any other elements or attributes.

*   **Logical Structure:** The structure of the outline must be logical, reflecting the hierarchical relationships and argumentation flow of the section content. Subsections should elaborate on and support the theme of their parent section.
*   **Level of Detail:** The outline should be detailed enough to guide subsequent writing.
*   **Number Restrictions:**
    *   Each section can only contain 3 `subsection` elements.
    *   Each `subsection` should have between 3 and 4 `subsubsection` elements.
    *   Exception: `subsubsection` elements are not mandatory in the `Introduction` and `Conclusion` sections, but can be added if needed.

*   **Number of References:** All 'Reference_Paper_Chunks' must be allocated to the subsections; none should be omitted.
*   **Reference Allocation:**
    *   The same document can be cited by multiple subsections.
    *   Sections requiring detailed analysis, in-depth discussion, or supporting evidence should be allocated **more** references(**Contains at least 6 papers and up to 10 papers**).
    *   Sections that are overview-like, introductory, or summarizing can be allocated **fewer** references.
*   **Content Relevance**: The generated outline content must be relevant to the "User_Requirement," "Review_Type," and "Section_Title."

# Output
Strictly following the above requirements, generate the detailed outline for the "{section_title}" section.

# Special Attention
    The references in different subsubsections must be completely different.
    Each section can only contain 3 `subsection` elements.
    A maximum of 8 references are allocated to each subsubsection
    A maximum of 8 references are allocated to each subsubsection
    A maximum of 8 references are allocated to each subsubsection
"""